package com.tencent.wxcloudrun.vo.request.user;

import java.time.LocalDateTime;
import java.util.Date;

import com.tencent.wxcloudrun.domain.TUser;
import com.tencent.wxcloudrun.enums.UserStatEnum;
import com.tencent.wxcloudrun.enums.UserTypeEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * @Author ZhaoZiYin
 * @Date 2025/4/22
 * @Description 用户新增请求入参
 */
@Data
@ApiModel(value = "UserAddRequest", description = "用户新增请求入参")
public class UserAddReqVo {

    @ApiModelProperty("用户名称")
    private String name;

    @ApiModelProperty("用户头像")
    private String avatar;

    @ApiModelProperty("用户手机号")
    private String phone;

    @NotBlank
    @ApiModelProperty("微信用户唯一标识")
    private String wxOpenId;

    public TUser build() {
        TUser user = new TUser();
        user.setWxOpenId(wxOpenId);
        user.setStatus(UserStatEnum.NORMAL.getValue());
        user.setName(name);
        user.setType(UserTypeEnum.PLAYER.getValue());
        user.setAvatar(avatar);
        user.setPhone(phone);
        user.setCreatedTime(LocalDateTime.now());
        user.setUpdatedTime(LocalDateTime.now());
        return user;
    }

}
